<script setup>

    defineProps({
        menu: Array,
        btn_a: Function,
        onPage: Function,
    });

</script>

<template>
    <ul>
        <li v-for="(btn, i) in menu" :key="i">
            <a @click="onPage(btn.url, btn.params)" :class="['transition', { 'active': btn_a(btn.url) }]" :href="'#'+btn.url">{{btn.title}}</a>
            <!-- 如果当前菜单项有子菜单，递归渲染 -->
            <recursive-menu v-if="btn.children && btn.children.length > 0" :menu="btn.children" :onPage="onPage" :btn_a="btn_a"></recursive-menu>
        </li>
    </ul>
</template>